package com.kuyu.enums;

import lombok.Getter;

@Getter
public enum  OrderStatusEnum {
    NEW(0, "新订单"),
    FINISHED(1, "完结"),
    CANCEL(2, "已取消"),
    ;
    private Integer code;
    private String message;

    OrderStatusEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }
    // 普通方法:根据索引找到对应名称
    public static String getName(int index) {
        for (OrderStatusEnum c : OrderStatusEnum.values()) {
            if (c.getCode() == index) {
                return c.getMessage();
            }
        }
        return null;
    }

}
